package com.mcxx.util;

import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import com.mcxx.constant.HxConstant;


public class SecurityUtils {
    private static SymmetricCrypto sm4 = SmUtil.sm4(HxConstant.SM4_SECRET_KEY.getBytes());

    public static String encryptBase64(String key) {
        return sm4.encryptBase64(key);
    }

    public static String decryptStr(String str) {
        return sm4.decryptStr(str, CharsetUtil.CHARSET_UTF_8);
    }
}
